home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8949 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: peer-news.britain.eu.net!strath-cs!abrown
  2. From: abrown@cs.strath.ac.uk (Andrew G Brown CES92)
  3. Newsgroups: comp.unix.programmer,comp.unix.questions,comp.lang.c
  4. Subject: Help: Inter Process Queues
  5. Date: 7 Mar 1996 14:00:05 GMT
  6. Organization: Computer Science Dept., Strathclyde University., Glasgow, Scotland.
  7. Distribution: world
  8. Message-ID: <4hmq55$2sn@dunlop.cs.strath.ac.uk>
  9. NNTP-Posting-Host: muir-01.cs.strath.ac.uk
  10.  
  11. I was wondering if anyone out there could show me how to set up a 
  12. UNIX queue between a number of processes written in 'C'.
  13.  
  14. I have initiated the queue using msgget() which returns the Q id. 
  15. However I am not sure what permissions I need to set in the msqid_ds
  16. structure that I need to pass to msgctl().
  17.  
  18. At the moment I m trying the following...
  19.  
  20.     key = ftok("queue", 'z')
  21.     qid = msgget( key, IPC_CREAT);
  22.  
  23.     buf.msg_perm.uid = getuid();
  24.     buf.msg_perm.gid = getgid();
  25.     buf.msg_perm.cuid = PERM.uid; 
  26.     buf.msg_perm.cgid = PERM.gid;
  27.     buf.msg_perm.mode = 0x1FF;     /* <= 111,111,111 */
  28.     buf.msg_perm.seq  = 0;     
  29.     buf.msg_perm.key = key;       
  30.  
  31.     buf.msg_qbytes = 10240;
  32.     buf.msg_ctime  = time( NULL );
  33.  
  34.     msgctl(qid, IPC_SET, &buf);
  35.  
  36. However when I attempt to send a message to the queue from the same
  37. process using msgsnd() I get an EACESS error, meaning that I do not
  38. have the correct permission.
  39.  
  40. Any help would be greatly appreciated, as this queue is an 
  41. important part of an application I am writing for my final year
  42. project.
  43.  
  44.  
  45. Many thanks..
  46.  
  47.  
  48.   Andrew Brown
  49.